<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>指令管理 - WMS仓库管理系统</title>
    <link rel="stylesheet" href="css/style.css">
</head>
<body>
    <div class="container">
        <!-- 登录界面 -->
        <section id="loginSection" class="login-section">
            <div class="login-container">
                <h2>WMS仓库管理系统登录</h2>
                <form id="loginForm">
                    <div class="form-group">
                        <label for="username">用户名:</label>
                        <input type="text" id="username" required>
                    </div>
                    <div class="form-group">
                        <label for="password">密码:</label>
                        <input type="password" id="password" required>
                    </div>
                    <button type="submit" class="btn-primary">登录</button>
                    <p>默认管理员账号: admin / 123456</p>
                </form>
            </div>
        </section>

        <!-- 主内容界面 -->
        <div id="mainContent" class="main-content">
            <header>
                <h1>指令管理</h1>
                <p>管理设备指令和执行历史</p>
                <div class="header-actions">
                    <a href="index.html" class="btn-secondary">返回首页</a>
                    <button id="logoutBtn" class="btn-secondary">退出登录</button>
                </div>
            </header>

            <main>
                <nav class="module-nav">
                    <ul>
                        <li><a href="#instruction-list" class="active">指令列表</a></li>
                        <li><a href="#instruction-history">指令历史查询</a></li>
                    </ul>
                </nav>

                <!-- 指令列表 -->
                <section id="instruction-list" class="module-section active">
                    <h2>指令列表</h2>
                    <div class="header-actions">
                        <button id="addInstructionBtn" class="btn-primary">创建指令</button>
                        <button id="refreshCurrentBtn" class="btn-secondary">刷新</button>
                    </div>
                    <div class="table-container">
                        <table id="instructionTable">
                            <thead>
                                <tr>
                                    <th>编号</th>
                                    <th>任务号</th>
                                    <th>任务类型</th>
                                    <th>托盘号</th>
                                    <th>开始货位</th>
                                    <th>目标货位</th>
                                    <th>开始设备</th>
                                    <th>结束设备</th>
                                    <th>物料码</th>
                                    <th>物料名称</th>
                                    <th>执行数量</th>
                                    <th>指令状态</th>
                                    <th>完成方式</th>
                                    <th>完成时间</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
                                <!-- 指令数据将通过JavaScript动态加载 -->
                            </tbody>
                        </table>
                    </div>
                </section>

                <!-- 指令历史查询 -->
                <section id="instruction-history" class="module-section">
                    <h2>指令历史查询</h2>
                    <div class="header-actions">
                        <button id="refreshHistoryBtn" class="btn-secondary">刷新</button>
                    </div>
                    <div class="filter-controls">
                        <div class="form-group">
                            <label>任务类型:</label>
                            <select id="instructionTypeFilter">
                                <option value="">全部</option>
                                <option value="入库">入库</option>
                                <option value="出库">出库</option>
                                <option value="移库">移库</option>
                                <option value="盘点">盘点</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <label>日期范围:</label>
                            <input type="date" id="startDateFilter">
                            <input type="date" id="endDateFilter">
                        </div>
                        <button id="filterInstructionsBtn" class="btn-primary">筛选</button>
                    </div>
                    <div class="table-container">
                        <table id="instructionHistoryTable">
                            <thead>
                                <tr>
                                    <th>编号</th>
                                    <th>任务号</th>
                                    <th>任务类型</th>
                                    <th>托盘号</th>
                                    <th>开始货位</th>
                                    <th>目标货位</th>
                                    <th>开始设备</th>
                                    <th>结束设备</th>
                                    <th>物料码</th>
                                    <th>物料名称</th>
                                    <th>执行数量</th>
                                    <th>指令状态</th>
                                    <th>完成方式</th>
                                    <th>完成时间</th>
                                </tr>
                            </thead>
                            <tbody>
                                <!-- 指令历史数据将通过JavaScript动态加载 -->
                            </tbody>
                        </table>
                    </div>
                </section>
            </main>
        </div>

        <!-- 创建指令模态框 -->
        <div id="addInstructionModal" class="modal">
            <div class="modal-content">
                <span class="close">&times;</span>
                <h2>创建指令</h2>
                <form id="addInstructionForm">
                    <div class="form-group">
                        <label for="taskId">任务号:</label>
                        <input type="text" id="taskId" required>
                    </div>
                    <div class="form-group">
                        <label for="taskType">任务类型:</label>
                        <select id="taskType" required>
                            <option value="入库">入库</option>
                            <option value="出库">出库</option>
                            <option value="移库">移库</option>
                            <option value="盘点">盘点</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label for="palletId">托盘号:</label>
                        <input type="text" id="palletId">
                    </div>
                    <div class="form-group">
                        <label for="startLocation">开始货位:</label>
                        <input type="text" id="startLocation">
                    </div>
                    <div class="form-group">
                        <label for="targetLocation">目标货位:</label>
                        <input type="text" id="targetLocation">
                    </div>
                    <div class="form-group">
                        <label for="startDevice">开始设备:</label>
                        <input type="text" id="startDevice">
                    </div>
                    <div class="form-group">
                        <label for="endDevice">结束设备:</label>
                        <input type="text" id="endDevice">
                    </div>
                    <div class="form-group">
                        <label for="materialCode">物料码:</label>
                        <input type="text" id="materialCode">
                    </div>
                    <div class="form-group">
                        <label for="materialName">物料名称:</label>
                        <input type="text" id="materialName">
                    </div>
                    <div class="form-group">
                        <label for="executeQuantity">执行数量:</label>
                        <input type="number" id="executeQuantity" min="0" value="0">
                    </div>
                    <button type="submit" class="btn-primary">创建指令</button>
                </form>
            </div>
        </div>
    </div>

    <script src="js/instruction.js"></script>
</body>
</html>